package com.kellycheung.chicken_go_go;

import android.graphics.Canvas;
import android.graphics.Paint;

public class GeometryObj extends BaseObject {
	protected GGeometry ggShape;
	protected int iColor;
	protected int iAlpha;
	
	public GeometryObj(GameScene p_gsScene , int p_iZOrder , GOAnchor p_goa ) {
		this( p_gsScene , p_iZOrder , p_goa , 0f , 0f );
	}

	public GeometryObj(GameScene p_gsScene , int p_iZOrder , GOAnchor p_goa , float p_fX , float p_fY ) {
		super( p_gsScene , p_iZOrder , p_goa , p_fX , p_fY );
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public void destroy() {
		try {
			this.ggShape = null;
			
			super.destroy();
        } catch ( Exception p_e ) {
			// TODO Auto-generated catch block
			GameUtil.LogMsg( this , "GeometryObj.destroy" );
			GameUtil.ErrorHandler( this , p_e );
		}
	}
	
	public void setGeometry( GGeometry p_ggShape , int p_iColor , int p_iAlpha ) {
		try {
			this.ggShape = p_ggShape;
			this.iColor = p_iColor;
			this.iAlpha = p_iAlpha;
        } catch ( Exception p_e ) {
			// TODO Auto-generated catch block
			GameUtil.LogMsg( this , "GeometryObj.setGeometry" );
			GameUtil.ErrorHandler( this , p_e );
		}
	}

	@Override
	public void draw( Canvas p_c , Paint p_p ) {
		// TODO Auto-generated method stub
		try {
			if ( this.ggShape != null ) {
				this.ggShape.draw( p_c , p_p , this.iColor , this.iAlpha );
			}
        } catch ( Exception p_e ) {
			// TODO Auto-generated catch block
			GameUtil.LogMsg( this , "GeometryObj.draw" );
			GameUtil.ErrorHandler( this , p_e );
		}
	}

	@Override
	public void preGameLoopLogic() {
	}

	@Override
	public void gameLoopLogic() {
	}

	@Override
	public void postGameLoopLogic() {
	}
}
